package com.restaurant.application.indexes.exchangegoodslist.mysql;

import com.google.common.collect.Lists;
import com.nebutown.generation.Convert;
import com.nebutown.generation.PickableBean;
import com.nebutown.generation.basictype.UID;

import java.util.List;

public class ExchangeGoodsListBean implements PickableBean {

    public static final String FN_RECORDID = "recordId";
    public static final String FN_EXCHANGEGOODS = "ExchangeGoods";
    public static final String FN_ACCUMULATE = "accumulate";
    public static final String FN_CREATETIME = "createTime";
    public static final String FN_CUSTOMERUID = "customerUid";
    public static final String FN_CUSTOMERID = "customerId";
    public static final String FN_PHONE = "phone";
    public static final String FN_NICKNAME = "nickName";
    public static final String FN_GOODSUID = "goodsUID";
    public static final String FN_GOODSNAME = "goodsName";
    public static final String FN_GOODSID = "goodsId";

    public static final List<String> FIELD_NAMES = Lists.newArrayList(
             FN_RECORDID,
             FN_EXCHANGEGOODS,
             FN_ACCUMULATE,
             FN_CREATETIME,
             FN_CUSTOMERUID,
             FN_CUSTOMERID,
             FN_PHONE,
             FN_NICKNAME,
             FN_GOODSUID,
             FN_GOODSNAME,
             FN_GOODSID);

    private Long recordId;
    private UID ExchangeGoods;
    private Long accumulate;
    private Long createTime;
    private UID customerUid;
    private String customerId;
    private String phone;
    private String nickName;
    private UID goodsUID;
    private String goodsName;
    private String goodsId;

    public ExchangeGoodsListBean(Long recordId, UID ExchangeGoods, Long accumulate, Long createTime, UID customerUid, String customerId, String phone, String nickName, UID goodsUID, String goodsName, String goodsId) {
        setRecordId(recordId);
        setExchangeGoods(ExchangeGoods);
        setAccumulate(accumulate);
        setCreateTime(createTime);
        setCustomerUid(customerUid);
        setCustomerId(customerId);
        setPhone(phone);
        setNickName(nickName);
        setGoodsUID(goodsUID);
        setGoodsName(goodsName);
        setGoodsId(goodsId);
    }

    public ExchangeGoodsListBean() {
    }

    public ExchangeGoodsListBean duplicate() {
        ExchangeGoodsListBean result = new ExchangeGoodsListBean();
        result.recordId = this.recordId;
        result.ExchangeGoods = this.ExchangeGoods;
        result.accumulate = this.accumulate;
        result.createTime = this.createTime;
        result.customerUid = this.customerUid;
        result.customerId = this.customerId;
        result.phone = this.phone;
        result.nickName = this.nickName;
        result.goodsUID = this.goodsUID;
        result.goodsName = this.goodsName;
        result.goodsId = this.goodsId;
        return result;
    }

    @Override
    public String toString() {
        return Convert.toJson(this);
    }

    public Long getRecordId() {
        return recordId;
    }

    public void  setRecordId(Long value) {
        this.recordId = value;
    }

    public ExchangeGoodsListBean withRecordId(Long value) {
        setRecordId(value);
        return this;
    }

    public ExchangeGoodsListBean withRecordId(Long value, Long defaultValue) {
        setRecordId(value == null ? defaultValue : value);
        return this;
    }

    public UID getExchangeGoods() {
        return ExchangeGoods;
    }

    public void  setExchangeGoods(UID value) {
        this.ExchangeGoods = value;
    }

    public ExchangeGoodsListBean withExchangeGoods(UID value) {
        setExchangeGoods(value);
        return this;
    }

    public ExchangeGoodsListBean withExchangeGoods(UID value, UID defaultValue) {
        setExchangeGoods(value == null ? defaultValue : value);
        return this;
    }

    public Long getAccumulate() {
        return accumulate;
    }

    public void  setAccumulate(Long value) {
        this.accumulate = value;
    }

    public ExchangeGoodsListBean withAccumulate(Long value) {
        setAccumulate(value);
        return this;
    }

    public ExchangeGoodsListBean withAccumulate(Long value, Long defaultValue) {
        setAccumulate(value == null ? defaultValue : value);
        return this;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void  setCreateTime(Long value) {
        this.createTime = value;
    }

    public ExchangeGoodsListBean withCreateTime(Long value) {
        setCreateTime(value);
        return this;
    }

    public ExchangeGoodsListBean withCreateTime(Long value, Long defaultValue) {
        setCreateTime(value == null ? defaultValue : value);
        return this;
    }

    public UID getCustomerUid() {
        return customerUid;
    }

    public void  setCustomerUid(UID value) {
        this.customerUid = value;
    }

    public ExchangeGoodsListBean withCustomerUid(UID value) {
        setCustomerUid(value);
        return this;
    }

    public ExchangeGoodsListBean withCustomerUid(UID value, UID defaultValue) {
        setCustomerUid(value == null ? defaultValue : value);
        return this;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void  setCustomerId(String value) {
        this.customerId = value;
    }

    public ExchangeGoodsListBean withCustomerId(String value) {
        setCustomerId(value);
        return this;
    }

    public ExchangeGoodsListBean withCustomerId(String value, String defaultValue) {
        setCustomerId(value == null ? defaultValue : value);
        return this;
    }

    public String getPhone() {
        return phone;
    }

    public void  setPhone(String value) {
        this.phone = value;
    }

    public ExchangeGoodsListBean withPhone(String value) {
        setPhone(value);
        return this;
    }

    public ExchangeGoodsListBean withPhone(String value, String defaultValue) {
        setPhone(value == null ? defaultValue : value);
        return this;
    }

    public String getNickName() {
        return nickName;
    }

    public void  setNickName(String value) {
        this.nickName = value;
    }

    public ExchangeGoodsListBean withNickName(String value) {
        setNickName(value);
        return this;
    }

    public ExchangeGoodsListBean withNickName(String value, String defaultValue) {
        setNickName(value == null ? defaultValue : value);
        return this;
    }

    public UID getGoodsUID() {
        return goodsUID;
    }

    public void  setGoodsUID(UID value) {
        this.goodsUID = value;
    }

    public ExchangeGoodsListBean withGoodsUID(UID value) {
        setGoodsUID(value);
        return this;
    }

    public ExchangeGoodsListBean withGoodsUID(UID value, UID defaultValue) {
        setGoodsUID(value == null ? defaultValue : value);
        return this;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void  setGoodsName(String value) {
        this.goodsName = value;
    }

    public ExchangeGoodsListBean withGoodsName(String value) {
        setGoodsName(value);
        return this;
    }

    public ExchangeGoodsListBean withGoodsName(String value, String defaultValue) {
        setGoodsName(value == null ? defaultValue : value);
        return this;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void  setGoodsId(String value) {
        this.goodsId = value;
    }

    public ExchangeGoodsListBean withGoodsId(String value) {
        setGoodsId(value);
        return this;
    }

    public ExchangeGoodsListBean withGoodsId(String value, String defaultValue) {
        setGoodsId(value == null ? defaultValue : value);
        return this;
    }

    public Object getValueOf(String name) {
        switch(name) {
        case "recordId": return getRecordId();
        case "ExchangeGoods": return getExchangeGoods();
        case "accumulate": return getAccumulate();
        case "createTime": return getCreateTime();
        case "customerUid": return getCustomerUid();
        case "customerId": return getCustomerId();
        case "phone": return getPhone();
        case "nickName": return getNickName();
        case "goodsUID": return getGoodsUID();
        case "goodsName": return getGoodsName();
        case "goodsId": return getGoodsId();
        }
        return null;
    }

    public boolean hasField(String name) {
        return FIELD_NAMES.contains(name);
    }

    @Override
    public int hashCode() {
        return signature().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if(!(o instanceof ExchangeGoodsListBean)) return false;
        return signature().equals(((ExchangeGoodsListBean)o).signature());
    }

    public String signature() {
        throw new RuntimeException("Bean ExchangeGoodsListBean has no signature defined, no hash code or equals possible.");
    }
}
